package com.ssn.iterator.books;

import java.util.ArrayList;
import java.util.List;

public class Books implements Aggregate {
    private int size;
    private List<Book> books;
    Books() {
        books = new ArrayList<>();
    }
    public int size() {
        return size;
    }
    public  void addItem(Object o) {
        books.add((Book) o);
        size ++;
    }
    public  void delItem(Object o) {
        books.remove(o);
    }
    public Book get(int i){
        return books.get(i);
    }
    @Override
    public Iterator iterator() {
        return new BookIterator(this);
    }
}
